package com.zhangye.test.api;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zhangye.test.model.Company;
import com.zhangye.test.service.CompanyService;

/**
 * 轮播
 * 作者： 张叶
 * 创建时间：2018年7月2日  下午3:30:42
 */
@Controller
@RequestMapping("api/company")
public class CompanyApi {

	@Autowired
	private CompanyService companyService;
	

	/**获取视频播放历史
	 * 
	 * 作者： 张叶
	 * 创建时间：2018年7月2日  下午5:14:38
	 */
	@ResponseBody
	@RequestMapping(value = "/history", method = RequestMethod.POST)
	public ApiResult login(HttpServletRequest request,
			HttpServletResponse response, String uuid) {
		ApiResult result = new ApiResult();
		if(uuid != null && !"".equals(uuid)){
			String where = " and image_uuid = '" + uuid + "' and active = -1 order by update_date desc";
			List<Company> list = companyService.selectByWhere(where);
			if(list.size() > 0){
				result.data.put("company", list);
				result.msg.status = 0;
				result.msg.desc = "获取成功";
			}else{
				result.msg.status = 1;
				result.msg.desc = "暂无数据";
			}
		} else {
			result.msg.status = 2;
			result.msg.desc = "参数不能为空！";
		}
		return result;
	}
	
	
}
